package myqueue;

public class MyQueue {
    private final int QUEUE_SIZE = 10;
    private int[] queue = new int[QUEUE_SIZE];
    private int readPos = 0;
    private int writePos = 0;
    private int currentSize = 0;

    public int put(int value) {
        if (currentSize >= QUEUE_SIZE) {
            return -1;
        }
        queue[writePos] = value;
        currentSize++;
        writePos = (writePos + 1) % QUEUE_SIZE;
        return 0;
    }

    public int get() {
        int value = 0;
        if(currentSize <= 0){
            return -1;
        }
        value = queue[readPos];
        currentSize--;
        readPos--;
        return 0;
    }
}
